﻿package com.extra_archive.framework.utils {
	import flash.display.*;
	import flash.system.ApplicationDomain;
	import flash.text.TextField;

	//==================================================================
	//@class name  :  LibraryUtils.as
	//@author          : vkimone. KimKiJeung  (http://kimkijeung.com)
	//@last update   : 2007. 12. 03
	//@version         : V1.0
	//==================================================================
	public class LibraryUtils {

		/**
		 * retrieve the movieClip with a specified class name in ApplicationDomain.
		 * @param applicationDomain
		 * @param className    name of Class in Linkage Properties
		 */
		public static function getMovieClipAsset(applicationDomain : ApplicationDomain,name : String) : MovieClip {
			var Definition : Class = applicationDomain.getDefinition(name) as Class;
			var asset : MovieClip = new Definition() as MovieClip;
			return asset;
		}

		
		/**
		 * retrieve the BitamapData with a specified class name in ApplicationDomain.
		 * @param applicationdomain 
		 * @param name    name of Class in Linkage Properties
		 */
		public static function getBitmapDataAsset(applicationDomain : ApplicationDomain,name : String) : BitmapData {
			var Definition : Class = applicationDomain.getDefinition(name) as Class;
			var asset : BitmapData = new Definition(0, 0) as BitmapData;
			return asset;
		}

		
		public static function getTextFieldAsset(applicationDomain : ApplicationDomain,name : String) : TextField {
			var Definition : Class = applicationDomain.getDefinition(name) as Class;
			var asset : TextField = new Definition() as TextField;
			return asset;
		}
	}
}
